//
//  DYJSerialContentTableViewCell.m
//  Piece
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 Northeast Dianli University. All rights reserved.
//

#import "DYJSerialContentTableViewCell.h"

@implementation DYJSerialContentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentTextView.font = [UIFont systemFontOfSize:14];
    [self.contentTextView setUserInteractionEnabled:NO];
}
- (void)setModel:(DYJSerialContentModel *)model
{
    if (_model != model) {
        _model = model;
        self.contentTextView.text = model.content;
        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithData:[model.content dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
        NSRange range = NSMakeRange(0, attributedString.length);
        [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:range];
        self.contentTextView.attributedText = attributedString;
//        NSString *contentStr = [attributedString string];
//        NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14], NSFontAttributeName, nil];
//        CGRect rect = [contentStr boundingRectWithSize:CGSizeMake(ScreenWidth - 20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context:nil];
//        self.contentTextView.frame = CGRectMake(10, 10, rect.size.width, rect.size.height);
        
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
